package com.yzq.controller;

import com.yzq.common.Result;
import com.yzq.model.dto.VerificationCodeRequest;
import com.yzq.service.VerificationCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "验证码")
@Slf4j
@RestController
public class VerificationCodeController {
    @Resource
    private VerificationCodeService verificationCodeService;

    @ApiOperation("发送验证码")
    @PostMapping("/sendVerificationCode")
    public Result<String> sendVerificationCode(@RequestBody VerificationCodeRequest verificationCodeRequest) {
        verificationCodeService.sendVerificationCode(
                verificationCodeRequest.getUserIdentifier(),
                verificationCodeRequest.getBusinessType()
        );
        return Result.success("验证码发送成功");
    }
}
